package com.kaishengit.util;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class MessageTag extends SimpleTagSupport {
	@Override
	public void doTag() throws JspException, IOException {
		
		JspWriter out = getJspContext().getOut();
		
		Message message = (Message) getJspContext().getAttribute("message", PageContext.SESSION_SCOPE);
		if(message != null){
			out.print("<div class=\""+message.getType()+"\" >"+message.getMessage()+"</div>");
			getJspContext().removeAttribute("message",PageContext.SESSION_SCOPE);
		}
	}
}
